<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>07-数组</title>
</head>
<body>
<script>
  var names = ["孙悟空", "猪八戒", "唐僧", "沙僧"]  //定义数组
  console.log(name, typeof name)
  console.log(names[0])  // 根据索引查询数组中的数据
  console.log(names.length)
<!--  delete names[1]  // 根据索引, 删除数组中的数据-->
<!--  console.log(names)  //['孙悟空', empty, '唐僧', '沙僧']-->
<!--  names[4] = '蜘蛛精'  // 新增-->
<!--  console.log(names)-->
<!--  names[1] = "白骨精"  // 修改-->
<!--  console.log(names)-->

  for (var i in name) {
    console.log(names[i])
  }
</script>
</body>
</html>